<template>
  <div class="hello">
    <h1>我是helloworld组件</h1>
    <h1>我是名字是：{{names}}</h1>
    <h1>我是年龄是：{{age}}</h1>
    <h1>我是性别是：{{sex}}</h1>
    <h1>改变的年龄是：{{ageing}}</h1>
    <button @click="func2()">点击变年轻</button>
  </div>
</template>

<script>
export default {
  name: 'HelloWorld',
  // props父向子传递值
  props:["names","age","sex"],
  data() {
    return {
      ageing:this.age,
    }
  },
  methods: {
    func2(){
      this.ageing = 10;
    }
  },
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
